CHARTS

Glass Ceiling Index

Bar Vertical Ordered

Photo by CDoncel on Unsplash

Photo by CDoncel on Unsplash

The glass ceiling doesn’t apply when you’re building your own house…
— Heidi Roizen


Ingest

country, score, and measures

url_root <- "https://raw.githubusercontent.com/UN-AVT/kamino-source/main/sources/0-shared/data/"
url_file <- "glass-ceiling-index/glass-ceiling-index.csv"
url <- paste0(url_root, url_file)

df <- read.csv(url, header = TRUE, stringsAsFactors = FALSE)
df

Wrangle

convert strings to numeric

df_wrangle <- df

# multi-column replacement
pc_txt <- c("Women.in.senior.managerial.positions", "Women.on.company.boards", "GMAT.exam.taken.by.women", "Women.in.parliament") 
df_wrangle[pc_txt] <- lapply(df_wrangle[pc_txt], gsub, pattern = "% of total", replacement = "")

# single column replacements
df_wrangle$Population.with.tertiary.deducation <- gsub(pattern = " % points", replacement = "", df_wrangle$Population.with.tertiary.deducation)
df_wrangle$Labour.force.participation.rate <- gsub(pattern = "% points", replacement = "", df_wrangle$Labour.force.participation.rate)
df_wrangle$Gender.wage.gap <- gsub(pattern = "%", replacement = "", df_wrangle$Gender.wage.gap)
df_wrangle$Net.child.care.cost <- gsub(pattern = "% of average wage", replacement = "", df_wrangle$Net.child.care.cost)
df_wrangle$paid.maternity.leave <- gsub(pattern = " weeks at 100", replacement = "", df_wrangle$paid.maternity.leave)
df_wrangle$paid.maternity.leave <- gsub(pattern = "% of last earnings", replacement = "", df_wrangle$paid.maternity.leave)

# convert to factor for next operation
df_wrangle$Country <- as.factor(df_wrangle$Country)

# convert to numeric
df_wrangle <- df_wrangle %>% mutate_if(is.character,as.numeric)

# done
df_wrangle

Wrangle

conditional colors

# standard color: 7ABAD2
# OECD color: 6088C2
# Rank 1 color: D7B133
# Rank text box color: 46778D

df_wrangle <- df_wrangle %>% 
  mutate( TYPE = case_when(
  Country == "Finland" ~ "#D7B133",
  Country == "OECD avg" ~ "#6088C2",
  Country != "OECD avg" | Country != "Finland" ~ "#7ABAD2"
  )
)

df_show_color <- df_wrangle %>% select(Country, TYPE) %>% head(n=10)
df_show_color

Analytics

create a rank column

# order to make sure we have descending sort
df_ranked <- df_wrangle[order(-df_wrangle$Overall.score),]
# use row numbers as rankn
df_ranked <- df_ranked %>% mutate(RANK = row_number())

df_show_ranked <- df_ranked %>% select(Country, RANK) %>% head(n=10)
df_show_ranked

Plot

by overall rank and score, with conditional fill color, and a comparative marker

theme_opts <- theme(
    text = element_text(family = "inconsolata", size = 16), 
    plot.title = element_text(color = "black", size = 16, face = "bold"),
    plot.subtitle = element_text(color = "black", size = 12),
    plot.caption = element_text(color = "#555555", size = 11),
    plot.margin = margin(.25, 1, .25, .25, "in"),
    plot.background = element_blank(),
    panel.border = element_blank(),
    panel.background = element_blank(),
    panel.grid.minor.x = element_blank(),
    panel.grid.major.x = element_blank(),
    panel.grid.minor.y = element_blank(),
    #panel.grid.major.y = element_blank(),
    axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1, face = "bold", margin = margin(t = 8.5)),
    # axis.title.y = element_blank(),
    # axis.ticks.y = element_blank(),
    axis.ticks.x = element_blank(),
    # axis.ticks.x = element_line(),
    # axis.ticks.length.x = unit(.35, "cm"),
    # axis.text.x=element_blank(),
    legend.position = "none"
)

v1 <- ggplot(df_ranked, aes(x=reorder(Country, -RANK), y=Overall.score)) + 
      geom_bar(aes(fill=TYPE), stat="identity") +
      geom_label(aes(label = RANK, y = 0), fill = "#46778D", colour = "white", fontface = "bold", vjust = 1.35) +
      geom_point(data=subset(df_ranked, Country == "Israel"), aes(x = Country, y = Overall.score + 5), shape = 25, size = 3, color = "black", fill = "black") +
      scale_fill_identity() +
      scale_y_continuous(breaks = seq(0, 100, 20), limits = c(0, 100)) +
      scale_x_discrete(labels = function(x) paste0(x, " —")) + 
      coord_cartesian(clip="off") +
      labs(title = "The glass-ceiling index", subtitle = "Environment for working women", x = NULL, y = NULL) +
      theme_bw() +
      theme_opts

girafe(ggobj = v1, width_svg = 16, height_svg = 9,
       options = list(opts_sizing(rescale = TRUE, width = 0.8)))

Plot

using a different indicator, for comparison

v2 <- ggplot(df_ranked, aes(x=reorder(Country, Women.in.senior.managerial.positions), y=Women.in.senior.managerial.positions)) + 
      geom_bar(aes(fill=TYPE), stat="identity") +
      geom_label(aes(label = RANK, y = 0), fill = "#46778D", colour = "white", fontface = "bold", vjust = 1.35) +
      geom_point(data=subset(df_ranked, Country == "Israel"), aes(x = Country, y = Women.in.senior.managerial.positions + 5), shape = 25, size = 3, color = "black", fill = "black") +
      scale_fill_identity() +
      scale_y_continuous(breaks = seq(0, 100, 20), limits = c(0, 100)) +
      scale_x_discrete(labels = function(x) paste0(x, " —")) + 
      coord_cartesian(clip="off") +
      labs(title = "The glass-ceiling index", subtitle = "Women in senior managerial positions", x = NULL, y = NULL) +
      theme_bw() +
      theme_opts

girafe(ggobj = v2, width_svg = 16, height_svg = 9,
       options = list(opts_sizing(rescale = TRUE, width = 0.8)))

Plot

another indicator

v3 <- ggplot(df_ranked, aes(x=reorder(Country, Gender.wage.gap), y=Gender.wage.gap)) + 
      geom_bar(aes(fill=TYPE), stat="identity") +
      geom_label(aes(label = RANK, y = 0), fill = "#46778D", colour = "white", fontface = "bold", vjust = 1.35) +
      geom_point(data=subset(df_ranked, Country == "Israel"), aes(x = Country, y = Gender.wage.gap + 5), shape = 25, size = 3, color = "black", fill = "black") +
      scale_fill_identity() +
      scale_y_continuous(breaks = seq(0, 100, 20), limits = c(0, 100)) +
      scale_x_discrete(labels = function(x) paste0(x, " —")) + 
      coord_cartesian(clip="off") +
      labs(title = "The glass-ceiling index", subtitle = "Gender wage gap", x = NULL, y = NULL) +
      theme_bw() +
      theme_opts

girafe(ggobj = v3, width_svg = 16, height_svg = 9,
       options = list(opts_sizing(rescale = TRUE, width = 0.8)))

References

The citations and data sources used for this case

  • Narrative and Data Source, The Economist, The glass-ceiling index, GO